package poo.util;

public final class Mat {
	private static double EPSILON = 1.0E-14;

	private Mat() {
	}

	public static int mcd(int x, int y) {
		if (x <= 0 || y <= 0)
			throw new IllegalArgumentException();
		int r = 0;
		int n = x;
		int m = y;
		do {
			r = n % m;
			n = m;
			m = r;
		} while (r != 0);
		return n;
	}// mcd

	public static int mcm(int x, int y) {
		if (x <= 0 || y <= 0)
			throw new IllegalArgumentException();
		return (x * y) / mcd(x, y);
	}// mcm

	public static void setEpsilon(double EPSILON) {
		Mat.EPSILON = EPSILON;
	}

	public static double getEpsilon() {
		return EPSILON;
	}

	public static boolean sufficientementeProssimi(double x, double y) {
		return Math.abs(x - y) <= EPSILON;
	}

}
